package edu.java.lectures.lec08.patterns;

// Template Method (Design) Pattern
public abstract class Game {

    // --- Instance variables --------------------------------------------------
    private int playersCount;

    public Game(int playerCount) {
	this.playersCount = playerCount;
    }

    // --- Methods -------------------------------------------------------------

    // public + final --> it is forbidden for overriding by chidren
    public final void play() { // TEMPLATE METHOD
	initializeGame();
	for (int i = 0; i < 4; i++) {
	    int playerNumber = i % 2; // smqna na nomera na igrachinte
	    makePlay(playerNumber);
	}
	terminateGame();
	printWinner();
    }

    // protected --> to be visible only for children.
    protected abstract void initializeGame();

    protected abstract void makePlay(int player);

    protected abstract void terminateGame();

    protected abstract void printWinner();
}
